# coding=utf-8
# https://leetcode.cn/problems/longest-palindromic-substring/


class Solution:
    def longestPalindrome(self, s: str) -> str:
        hw = ''
        for i in range(len(s)):
            for j in range(1, len(s) - i + 1):
                zc = s[i:i + j]
                if zc == zc[::-1] and len(zc) >= len(hw):
                    hw = zc
        return hw

